import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { xzqhTreeSelectListApi } from '/@/api/wyf/xzqh/select';
import { sjlyOptionsListApi } from '@/api/wyf/pms/select';
import { filterDictTextByCache } from '/@/utils/dict/JDictSelectUtil';
import { render } from '@/utils/common/renderUtils';
import { h } from 'vue';
//公用查询
export const searchFormSchema: FormSchema[] = [
  {
    field: 'xzqh',
    label: '所属区域',
    //component: 'ApiTreeSelect',
    component: 'JCascader',
    componentProps: {
      api: xzqhTreeSelectListApi,
      params: {},
      //resultField: 'title',
      // fieldNames: {
      //   label: 'title',
      //   value: 'value',
      // },
      // multiple: true,
      changeOnSelect: true,
    },
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input', //渲染的组件
    componentProps: {
      //  dictCode: 'status',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input', //渲染的组件
  },
  {
    label: '处置状态',
    field: 'sjly',
    component: 'ApiSelect', //渲染的组件
    //defaultValue: '', //设置默认值
    componentProps: {
      api: sjlyOptionsListApi,
      resultField: 'result',
      labelField: 'mc',
      valueField: 'id',
    },
  },
  {
    label: '处置结果',
    field: 'rzbz',
    component: 'JDictSelectTag', //渲染的组件
    //defaultValue: '', //设置默认值
    componentProps: {
      dictCode: 'rzbz',
    },
  },
  {
    label: '预警时间',
    field: 'sjldsj_end',
    component: 'RangeDate',
    componentProps: {
      //日期格式化
      format: 'YYYY/MM/DD',
      //范围文本描述用集合
    },
  },
];
//处置表单数据
export const formSchemaDispose: FormSchema[] = [
  {
    label: '处置',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'sex',
      placeholder: '请选择性别',
      stringToNumber: true,
    },
    required: true,
  },
  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
//非正常经营入住记录数据
export const historyColumns: BasicColumn[] = [
  // {
  //   title: '数据来源',
  //   align: 'left',
  //   dataIndex: 'sjly_dictText',
  //   width: 120,
  //   // resizable: true,
  // },
  {
    title: '住客信息',
    align: 'left',
    dataIndex: 'sjly',
    width: 160,
    customRender: ({ text, record }) => {
      let xm, zjhm, lxdh, rzbz;
      if (record.tenantsList && record.tenantsList.length > 0) {
        xm = record.tenantsList[0].xm || '';
        zjhm = record.tenantsList[0].zjhm || '';
        lxdh = record.tenantsList[0].lxdh || '';
        rzbz = record.tenantsList[0].rzbz || '';
      }
      const rzbzText = filterDictTextByCache('rzbz', rzbz);
      const color = rzbz == '1' || rzbz == '3' ? 'text-green' : rzbz == '5' ? 'text-red' : 'text-waring';
      return h('div', { class: 'zkxx' }, [
        h('div', null, `${xm}`),
        h('div', null, `${zjhm}`),
        h('div', null, `${lxdh}`),
        h('div', { class: color }, `${rzbzText}`),
      ]);
    },
    //resizable: true,
  },
  {
    title: '预定入离时间',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.ddkssj ?? ''}~${record.ddjssj ?? ''}`;
    },
  },
  {
    title: '实际居住时间',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.sjrzsj ?? ''}~${record.sjldsj ?? ''}`;
    },
  },
];
//长期入住未退房预警入住记录数据
export const historyLongTermStayColumns: BasicColumn[] = [
  {
    title: '当前居住状态',
    align: 'left',
    dataIndex: 'jjzt',
    width: 120,
  },
  {
    title: '预定开始时间',
    align: 'left',
    dataIndex: 'ddkssj',
    width: 120,
  },
  {
    title: '预定结束时间',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 120,
  },
  {
    title: '实际居住开始时间',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
  },
  {
    title: '实际居住借宿时间',
    align: 'left',
    dataIndex: 'sjldsj',
    width: 160,
  },
];
// 开门记录
export const openinghColumns: BasicColumn[] = [
  {
    title: '开门时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '开门方式',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '开锁结果',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '住客姓名',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '住客身份证',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '住客电话号码',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '住客照片',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    customRender: render.renderAvatar,
  },
];

//长期未入住列表数据
export const columnsNoCheckIn: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    //resizable: true,
  },

  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },

  {
    title: '最后离店时间',
    align: 'center',
    dataIndex: 'sjldsj',
    width: 160,
    // customRender: ({ record }) => {
    //   return (record['sjrzsj'] ?? '') + ' ~ ' + (record['sjldsj'] ?? '');
    // },
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//长期未入住详情数据
export const detailSchemaNoCheckIn = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '房源信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    label: '房源编号',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '所属区域',
    field: 'xzqh',
    component: 'ApiTreeSelect',
    componentProps: {
      saveCode: 'region',
      placeholder: '请选择',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input',
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input',
  },
  {
    label: '营业状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '最后离店时间',
    field: 'fh',
    component: 'Input',
  },
  {
    field: '经营人信息',
    component: 'Input',
    label: '',
    slot: 'title2',
  },
  {
    label: '经营类型',
    field: 'jyrlx',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'jyrlx',
    },
    render: (text) => {
      return filterDictTextByCache('jyrlx', text);
    },
  },
  {
    label: '姓名',
    field: 'jyrxm',
    component: 'Input',
    ifShow: ({ values }) => values.jyrlx == 1,
  },
  {
    label: '身份证号',
    field: 'jyrzjhm',
    component: 'Input',
    ifShow: ({ values }) => values.jyrlx == 1,
  },
  {
    label: '联系方式',
    field: 'jyrlxdh',
    component: 'Input',
    ifShow: ({ values }) => values.jyrlx == 1,
  },
  {
    label: '单位名称',
    field: 'jyrdwmc',
    ifShow: ({ values }) => values.jyrlx != 1,
  },
  {
    label: '信用代码',
    field: 'tyshxydm',
    ifShow: ({ values }) => values.jyrlx != 1,
  },
];
//非正常经营房源预警列表数据
export const columnsAbnormalOperation: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    //resizable: true,
  },
  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },
  {
    title: '经营状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '非正常入住次数',
    align: 'center',
    dataIndex: 'sjldsj',
    width: 160,
    // customRender: ({ record }) => {
    //   return (record['sjrzsj'] ?? '') + ' ~ ' + (record['sjldsj'] ?? '');
    // },
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//非正常经营房源预警详情数据
export const detailSchemaAbnormalOperation = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '房源信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    label: '房源编号',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '所属区域',
    field: 'xzqh',
    component: 'ApiTreeSelect',
    componentProps: {
      saveCode: 'region',
      placeholder: '请选择',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input',
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input',
  },
  {
    label: '营业状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    field: '入住记录',
    component: 'Input',
    label: '',
    slot: 'title2',
    isTable: true,
  },
];

//频繁开门预警
export const columnsFrequentOpening: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    //resizable: true,
  },
  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },
  {
    title: '开门次数',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//频繁开门预警
export const detailSchemaFrequentOpening = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '房源信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    label: '房源编号',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '所属区域',
    field: 'xzqh',
    component: 'ApiTreeSelect',
    componentProps: {
      saveCode: 'region',
      placeholder: '请选择',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input',
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input',
  },
  {
    label: '营业状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    field: '住客信息',
    component: 'Input',
    label: '',
    slot: 'title2',
  },
  {
    field: '开门记录',
    component: 'Input',
    label: '',
    slot: 'title3',
    isTable: true,
  },
];

//长期入住未退房预警
export const columnsLongTermStay: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '住客信息',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '在住天数',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    //resizable: true,
  },
  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//长期入住未退房预警
export const detailSchemaLongTermStay = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '房源信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    label: '房源编号',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '所属区域',
    field: 'xzqh',
    component: 'ApiTreeSelect',
    componentProps: {
      saveCode: 'region',
      placeholder: '请选择',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input',
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input',
  },
  {
    label: '营业状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    field: '住客信息',
    component: 'Input',
    label: '',
    slot: 'title2',
  },
  {
    field: '入住记录',
    component: 'Input',
    label: '',
    slot: 'title3',
    isTable: true,
  },
];

//未成年人预警
export const columnsMinor: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '未成年人信息',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    //resizable: true,
  },
  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },
  {
    title: '监护人信息',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//未成年人预警
export const detailSchemaMinor = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '房源信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    label: '房源编号',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '所属区域',
    field: 'xzqh',
    component: 'ApiTreeSelect',
    componentProps: {
      saveCode: 'region',
      placeholder: '请选择',
    },
  },
  {
    label: '详细地址',
    field: 'fwdz',
    component: 'Input',
  },
  {
    label: '房源名称',
    field: 'fh',
    component: 'Input',
  },
  {
    label: '营业状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    field: '监护人信息',
    component: 'Input',
    label: '',
    slot: 'title2',
    isTable: true,
  },
  {
    field: '未成年信息',
    component: 'Input',
    label: '',
    slot: 'title3',
    isTable: true,
  },
];
//监护人信息
export const guardianColumns: BasicColumn[] = [
  {
    title: '监护人姓名',
    align: 'left',
    dataIndex: 'jjzt',
    width: 120,
  },
  {
    title: '身份证号码',
    align: 'left',
    dataIndex: 'ddkssj',
    width: 120,
  },
  {
    title: '手机号',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 120,
  },
  {
    title: '照片',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: render.renderAvatar,
  },
];
//未成年信息
export const underageColumns: BasicColumn[] = [
  {
    title: '未成年人姓名',
    align: 'left',
    dataIndex: 'jjzt',
    width: 120,
  },
  {
    title: '身份证号码',
    align: 'left',
    dataIndex: 'ddkssj',
    width: 120,
  },
  {
    title: '手机号',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 120,
  },
  {
    title: '年龄',
    align: 'left',
    dataIndex: 'jjzt',
    width: 120,
  },
  {
    title: '照片',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: render.renderAvatar,
  },
];

//一证多住
export const columnsStayMore: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '证件人信息',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '最近一次入住时间',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '入住房间数量',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//一证多住详情
export const detailSchemaStayMore = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '证件人信息',
    component: 'Input',
    label: '',
    slot: 'title2',
    isTable: true,
  },
  {
    field: '入住记录',
    component: 'Input',
    label: '',
    slot: 'title3',
    isTable: true,
  },
];
//一证多住入住记录数据
export const historyColumnsStayMore: BasicColumn[] = [
  {
    title: '住客信息',
    align: 'left',
    dataIndex: 'sjly',
    width: 160,
    customRender: ({ text, record }) => {
      let xm, zjhm, lxdh, rzbz;
      if (record.tenantsList && record.tenantsList.length > 0) {
        xm = record.tenantsList[0].xm || '';
        zjhm = record.tenantsList[0].zjhm || '';
        lxdh = record.tenantsList[0].lxdh || '';
        rzbz = record.tenantsList[0].rzbz || '';
      }
      const rzbzText = filterDictTextByCache('rzbz', rzbz);
      const color = rzbz == '1' || rzbz == '3' ? 'text-green' : rzbz == '5' ? 'text-red' : 'text-waring';
      return h('div', { class: 'zkxx' }, [
        h('div', null, `${xm}`),
        h('div', null, `${zjhm}`),
        h('div', null, `${lxdh}`),
        h('div', { class: color }, `${rzbzText}`),
      ]);
    },
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    width: 140,
  },
  {
    title: '房源地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 160,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '预定入离时间',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.ddkssj ?? ''}~${record.ddjssj ?? ''}`;
    },
  },
  {
    title: '实际居住时间',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.sjrzsj ?? ''}~${record.sjldsj ?? ''}`;
    },
  },
  {
    title: '入住状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
];

//一证多住证件人信息
export const columnsRZStayMore: BasicColumn[] = [
  {
    title: '证件人姓名',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
  },
  {
    title: '身份证号码',
    align: 'left',
    dataIndex: 'fh',
    width: 160,
  },
  {
    title: '手机号',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '使用该证件入住房间数',
    align: 'left',
    dataIndex: 'wyfbh',
    width: 180,
  },
  {
    title: '照片',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: render.renderAvatar,
  },
];
//频繁换房预警
export const columnsFrequentRoomChanges: BasicColumn[] = [
  {
    title: '预警时间',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
    // resizable: true,
  },
  {
    title: '住客信息',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '最近一次入住时间',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
    customRender: ({ text }) => {
      return '';
    },
  },
  {
    title: '换房次数',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '处置状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },

  {
    title: '处置结果',
    align: 'center',
    dataIndex: 'zkzt',
    width: 120,
    customRender: ({ text }) => {
      return render.renderDict(text, 'zkzt');
    },
  },
];
//频繁换房预警
export const detailSchemaFrequentRoomChanges = [
  {
    field: '处置信息',
    component: 'Input',
    label: '',
    slot: 'title',
  },
  {
    label: '预警信息',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    label: '处置状态',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '处置结果',
    field: 'fwjyzt',
    component: 'Input',
    render: (text) => {
      console.log(text, '字典');
      return filterDictTextByCache('fwjyzt', text);
    },
    color: (text) => {
      return text == 0 ? 'text-green' : text == 2 ? 'text-red' : 'text-waring';
    },
  },
  {
    label: '备注',
    field: 'wyfbh',
    component: 'Input',
  },
  {
    field: '住客信息',
    component: 'Input',
    label: '',
    slot: 'title2',
    isTable: true,
  },
  {
    field: '换房记录',
    component: 'Input',
    label: '',
    slot: 'title3',
    isTable: true,
  },
];

//频繁换房预警换房记录数据
export const historyColumnsFrequentRoomChanges: BasicColumn[] = [
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'wyfbh',
    width: 140,
  },
  {
    title: '房源地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 160,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '预定入离时间',
    align: 'left',
    dataIndex: 'ddjssj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.ddkssj ?? ''}~${record.ddjssj ?? ''}`;
    },
  },
  {
    title: '实际居住时间',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: ({ text, record }) => {
      return `${record.sjrzsj ?? ''}~${record.sjldsj ?? ''}`;
    },
  },
  {
    title: '入住状态',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
];

//频繁换房预警证件人信息
export const columnsRZFrequentRoomChanges: BasicColumn[] = [
  {
    title: '证件人姓名',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 170,
  },
  {
    title: '身份证号码',
    align: 'left',
    dataIndex: 'fh',
    width: 160,
  },
  {
    title: '手机号',
    align: 'left',
    dataIndex: 'fh',
    width: 100,
  },
  {
    title: '换房次数',
    align: 'left',
    dataIndex: 'wyfbh',
    width: 100,
  },
  {
    title: '照片',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: render.renderAvatar,
  },
];

//预警配置
export const columnsConfiguration: BasicColumn[] = [
  {
    title: '预警类型',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 200,
  },
  {
    title: '预警条件',
    align: 'left',
    dataIndex: 'fh',
    width: 200,
  },
];
//配置预警表单数据
export const formSchemaConfiguration: FormSchema[] = [
  {
    label: '无人入住天数>',
    field: 'sex0',
    component: 'InputNumber',
    colProps: { span: 20 },
    componentProps: {
      placeholder: '请输入天数',
      // prefix: '无人入住天数>',
    },
    suffix: '天时发出预警',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '存在以下经营状态的房源有入住记录时预警',
    field: 'rzbz0',
    colProps: { span: 24 },
    component: 'JDictSelectTag', //渲染的组件
    componentProps: {
      dictCode: 'rzbz',
      mode: 'multiple',
      placeholder: '请选择',
      //multiple: true,
    },
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '',
    field: 'sex7',
    component: 'TimePicker',
    colProps: { span: 12 },
    componentProps: {
      placeholder: '请选择时间',
      // prefix: '无人入住天数>',
    },
    suffix: '至',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '',
    field: 'rzbz2',
    colProps: { span: 10 },
    component: 'JDictSelectTag', //渲染的组件
    componentProps: {
      dictCode: 'rzbz',
      // mode: 'multiple',
    },
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '',
    field: 'sex8',
    component: 'TimePicker',
    colProps: { span: 18 },
    componentProps: {
      placeholder: '请选择时间',
      // prefix: '无人入住天数>',
    },
    suffix: '时间段内，成功开门 >',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '',
    field: 'sex5',
    component: 'InputNumber',
    colProps: { span: 16 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '次时，发出预警。',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '住客连续>',
    field: 'sex20',
    component: 'InputNumber',
    colProps: { span: 20 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '天住在同一房间时发出预警',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '平均',
    field: 'sex21',
    component: 'InputNumber',
    colProps: { span: 24 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '位以上未成年人的监护人为同一人时发出预警',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '长期在住未退房',
    field: 'sex22',
    component: 'InputNumber',
    colProps: { span: 24 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '天时发出预警',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '在',
    field: 'sex23',
    component: 'InputNumber',
    colProps: { span: 16 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '天内，换房>',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  {
    label: '',
    field: 'sex24',
    component: 'InputNumber',
    colProps: { span: 16 },
    componentProps: {
      placeholder: '请输入',
      // prefix: '无人入住天数>',
    },
    suffix: '次时，发出预警。 ',
    ifShow: ({ values }) => {
      return true;
    },
    required: true,
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '',
    field: 'type',
    component: 'Input',
    show: false,
  },
];
